<?php
class CommonComponent extends Object{

//called before Controller::beforeFilter()
function initialize(&$controller, $settings = array()) {
// saving the controller reference for later use
$this->controller =& $controller;
}

//called after Controller::beforeFilter()
function startup(&$controller) {
}

//called after Controller::beforeRender()
function beforeRender(&$controller) {
}

//called after Controller::render()
function shutdown(&$controller) {
}

//called before Controller::redirect()
function beforeRedirect(&$controller, $url, $status=null, $exit=true) {
}

function redirectSomewhere($value) {
// utilizing a controller method
}

function  getLocation(){
       $data= array(
           ''=>"Division",
           '1'=>'G&A',
           '2'=>"Medical",
           '3'=>"NBD",
           '4'=>"Fieldforce",
           '5'=>"Finance",
           '6'=>"Marketing",
           '7'=>"CEx",
           '8'=>"HR"
       );
       return $data;
}
function getDevices(){
    require_once ('lib/Mobile_Detect.php');
    $detect = new Mobile_Detect;
	$arr = array();	
	foreach($detect->getRules() as $name => $regex):
		$check = $detect->{'is'.$name}();
		if($check==1){
			$arr[]=$name;
		}
    endforeach;                
	$ver = array();
	
	 foreach($detect->getProperties() as $name => $match):
		$check = $detect->version($name);
		if($check!==false):
			$ver[]=array($name=>$check);
		endif;
	endforeach;
		$data= array(
			'ios'=>$arr,
			'ver'=>$ver
		);
	return $data;

}
}
?>
